<template>
  <div class="detail-container">
    <header class="detail-container-header">
      <svg @click="getBack" viewBox="0 0 547 987" id="arrow-right" width="100%" height="100%"><path d="M0 931.973l51.2 54.613 494.933-494.933L51.2.133 0 51.333l440.32 440.32L0 931.973z"></path></svg>
      <h1>商家详情</h1>
    </header>
    <div class="detail-content">
      <div class="shop-info">
        <section class="detail-section">
          <h3>活动与属性</h3>
          <div class="detail-div-new">
            <div class="detail-div-list" :key="index" v-for="(item,index) in shopDetailsList.activities">
              <i class="icon-pic" :style="'background-color: #'+item.icon_color+'; color: rgb(255, 255, 255); border-color: #'+item.icon_color+';'">{{item.icon_name}}</i>
              <span class="detail-div-span">
                <span>{{item.description}}</span>
              </span>
            </div>
            <div class="detail-div-list" :key="index" v-for="(item,index) in shopDetailsList.supports">
              <i class="icon-pic" :style="'background-color: #'+item.icon_color+'; color: rgb(255, 255, 255); border-color: #'+item.icon_color+';'">{{item.icon_name}}</i>
              <span class="detail-div-span">
                <span>{{item.description}}</span>
              </span>
            </div>
          </div>
        </section>
        <section class="detail-section">
          <h3>商家信息</h3>
          <ul class="detail-ul-list">
            <li>{{shopDetailsList.description}}</li>
            <li>地址：{{shopDetailsList.address}}</li>
            <li>营业时间：{{shopDetailsList.opening_hours[0]}}</li>
          </ul>
        </section>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'shopDetails',
  methods: {
    getBack: function () {
      this.$store.commit('HIDEDETAIL')
    }
  },
  computed: {
    shopDetailsList () {
      return this.$store.state.shopDetailsList
    }
  }
}
</script>

<style lang="scss" scoped>
  @import '../../static/hotcss/px2rem.scss';
  .detail-container{
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    overflow: auto;
    z-index: 100;
    background-color: #fff;
    .detail-container-header{
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      text-align: center;
      background-color: #2196f3;
      color: #fff;
      height: px2rem(88);
      line-height: px2rem(88);
      z-index: 10;
      svg{
        position: absolute;
        width: px2rem(60);
        height:  px2rem(40);
        left: px2rem(8);
        top:  px2rem(24);
        transform: rotate(180deg);
        fill: #fff;
      }
      h1{
        font-weight: 400;
        font-size: px2rem(40);
      }
    }
    .detail-content{
      padding-top: px2rem(88);
      height: 100%;
      box-sizing: border-box;
      overflow: auto;
      .shop-info{
        padding-top: px2rem(20);
        background-color: #eee;
        font-size: px2rem(26);
        overflow-y: auto;
        .detail-section{
          margin-bottom: px2rem(20);
          padding: 0 px2rem(30) px2rem(30);
          font-size: px2rem(26);
          background-color: #fff;
          color: #666;
          h3{
            margin: 0 px2rem(-30);
            padding: px2rem(16) px2rem(30);
            border-bottom: 1px solid #eee;
            color: #333;
            font-weight: 400;
            font-size: px2rem(30);
            line-height:px2rem(45);
          }
          .detail-div-new{
            .detail-div-list{
              margin: px2rem(30) 0;
              line-height: px2rem(32);
              display: flex;
              font-size: px2rem(20);
              .icon-pic{
                margin-right: px2rem(10);
                font-style: normal;
                line-height: 1;
                height:px2rem(22);
                display: inline-block;
                box-sizing: border-box;
                text-align: center;
                border: 1px solid;
                border-radius: px2rem(3);
                margin-top: px2rem(5);
              }
              .detail-div-span{
                display: inline-block;
                flex: 1;
                width: 0;
              }
            }
          }
          .detail-ul-list{
            li{
              padding: px2rem(30) px2rem(10) px2rem(30) 0;
              border-bottom: px2rem(1) solid #eee;
            }
          }
        }
      }
    }
  }
</style>